package com.yami.shop.listener;

import com.yami.shop.bean.event.PayManagerEvent;
import com.yami.shop.manager.impl.PayManager;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;


/**
 * 失效支付二维码
 * @author yami
 */
@Slf4j
@Component("PayManagerListener")
@AllArgsConstructor
public class PayManagerListener {

    private final PayManager payManager;


    @EventListener(PayManagerEvent.class)
    public void cancelOrderQrCode(PayManagerEvent event) {
        try {
            payManager.cancelOrderQrCode(event.getFilterPayInfo());
        } catch (Exception e) {
            log.error("失效支付二维码失败:", e);
        }
    }
}
